package com.example.dbdoc.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 表信息模型
 * 
 * @author 系统生成
 * @version 1.0.0
 */
public class TableInfo {
    
    /** 表名 */
    private String tableName;
    
    /** 表注释 */
    private String tableComment;
    
    /** 字段列表 */
    private List<ColumnInfo> columns;
    
    /** 索引列表 */
    private List<IndexInfo> indexes;
    
    public TableInfo() {
        this.columns = new ArrayList<>();
        this.indexes = new ArrayList<>();
    }
    
    public TableInfo(String tableName, String tableComment) {
        this();
        this.tableName = tableName;
        this.tableComment = tableComment;
    }
    
    // Getter和Setter方法
    public String getTableName() {
        return tableName;
    }
    
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    
    public String getTableComment() {
        return tableComment;
    }
    
    public void setTableComment(String tableComment) {
        this.tableComment = tableComment;
    }
    
    public List<ColumnInfo> getColumns() {
        return columns;
    }
    
    public void setColumns(List<ColumnInfo> columns) {
        this.columns = columns;
    }
    
    public List<IndexInfo> getIndexes() {
        return indexes;
    }
    
    public void setIndexes(List<IndexInfo> indexes) {
        this.indexes = indexes;
    }
    
    // 便利方法
    public void addColumn(ColumnInfo column) {
        this.columns.add(column);
    }
    
    public void addIndex(IndexInfo index) {
        this.indexes.add(index);
    }
    
    @Override
    public String toString() {
        return "TableInfo{" +
                "tableName='" + tableName + '\'' +
                ", tableComment='" + tableComment + '\'' +
                ", columns=" + columns.size() +
                ", indexes=" + indexes.size() +
                '}';
    }
}